function solution = PL_denoising_(data, method, alpha, beta)
% solution = PL_denoising_(data, method, alpha, beta)
% 
% PL_denoising_ is not intended to be called directly. Please see
% PL_denoising for further details and how to use it.
%
% See also: PL_denoising
%
% 2013-07-25 --------------------------------------------------------------
% 
% Matthias J. Ehrhardt
% CMIC, University College London, UK
% 
% matthias.ehrhardt.11@ucl.ac.uk
% 
% -------------------------------------------------------------------------

    % the operator and adjoint are the identity operators
    operator = @(x) (x);
    adjoint = @(x) (x);
    
    % set up the objective function and the starting point
    [x_0, indices, size_images] = Struct2vec(Im2struct(data));
    fun = @(x)(PL_objective_function(x, indices, size_images, data, operator, adjoint, method, 1, alpha, beta));

    % set up solver options
    solver_options.verbose = true;
    solver_options.n_iter = 1000;

    % run BFGS
    x_inf = L_BFGS(x_0, fun, solver_options);

    % shrink the pixel values to "visible" values, i.e. [0 255]
    x_inf = Shrink_colours(x_inf);

    % form the solution as an image
    solution = Vec2struct(x_inf, indices, size_images);
end